package com.lyf.viewapp.dialog.dialogplus;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.lyf.viewapp.base.BaseActivity;
import com.lyf.viewapp.R;
import com.lyf.viewapp.SimpleToolbar;
import com.lyf.viewapp.chart.PieChartActivity;
import com.lyf.viewapp.util.EnterBean;
import com.lyf.viewapp.util.EnterRecyclerAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * dialogplus 主界面
 * @author lyf
 * @date 2018年7月9日 09:45:18
 */
public class DialogPlusMainActivity extends BaseActivity {

    @BindView(R.id.dialog_plus_main_list)
    RecyclerView recyclerView;

    @BindView(R.id.dialog_plus_main_toolbar)
    SimpleToolbar mToolbar;

    private List<EnterBean> list;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_dialog_plus_main);
        ButterKnife.bind(this);

        list = new ArrayList<>();
        initDate();
    }

    private void initDate() {
        list.add(new EnterBean("DialogPlusOne", DialogPlusOneActivity.class));

        recyclerView.setLayoutManager(new LinearLayoutManager(this));
        EnterRecyclerAdapter adapter = new EnterRecyclerAdapter(R.layout.main_item,list);
        adapter.openLoadAnimation(BaseQuickAdapter.SLIDEIN_LEFT);
        recyclerView.setAdapter(adapter);
        adapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                Intent intent = new Intent(DialogPlusMainActivity.this, list.get(position).getActivity());
                startActivity(intent);
            }
        });
    }
}
